package com.ruoyi.client.fxiaoke.beans.results;

import com.google.common.base.MoreObjects;

import java.io.Serializable;

/**
 * API返回结果公共类
 * Created by zhongcy on 2017/1/6.
 */
public class CommonResult implements Serializable{

    private static final long serialVersionUID = 5118682887536083404L;

    /**
     * 结果返回码（0表示成功）
     */
    protected int errorCode=0;

    /**
     * 返回结果信息
     */
    protected String errorMessage = "success";

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
    public boolean isSuccess() {
        return errorCode == 0 ? true : false;
    }
    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("errorCode", errorCode)
                .add("errorMessage", errorMessage)
                .toString();
    }
}
